#include "mystdio.h"
#include <string.h>
#include <unistd.h>

int main()
{
    my_file* fp = my_fopen("log.txt","w");
    if(fp == NULL) return 1;

    const char* msg = "hello linus\n";
    char buf[128];
    int cnt=10;
    while(cnt--)
    {
        sprintf(buf,"%s-%d\n",msg,cnt);
        my_fwrite(fp,buf,strlen(buf));
        sleep(1);
        my_fflush(fp);
    }
    my_fwrite(fp,msg,strlen(msg));

    my_fflush(fp);
    my_fclose(fp);
    return 0;
}
